home *** CD-ROM | disk | FTP | other *** search
/ ...taking it to the Macs! / ...taking it to the Macs!.iso / Extras / ActiveX Mac SDK / ActiveX SDK / Sample Controls / BDiamond / BDVerify.cp < prev    next >
Encoding:
Text File  |  1996-12-20  |  880 b   |  25 lines  |  [TEXT/CWIE]

  1. #include "BDVerify.h"
  2.  
  3.  
  4. // checks a given addr to see if it points inside the contents of a PixMap
  5. // note: size defaults to one byte or unsigned char
  6. Boolean IsAddrInPixMap(const unsigned char* theAddr, const PixMapHandle aPixMap, const short size)
  7. {
  8.     // compute end of PixMap addr:
  9.     unsigned char* endPixMap =    (unsigned char*)((**aPixMap).baseAddr + ((**aPixMap).rowBytes 
  10.                                 * ((**aPixMap).bounds.top - (**aPixMap).bounds.bottom)));
  11.     return ((theAddr >= (unsigned char*)((**aPixMap).baseAddr)) && (theAddr <= endPixMap))
  12.                         && ((theAddr + size >= (unsigned char*)((**aPixMap).baseAddr)) && (theAddr + size <= endPixMap));    // baseAddr <= theAddr <= endPixMap
  13. }
  14.  
  15.  
  16. Boolean ValidRect(const Rect aRect)    // checks to make sure that rt >= lt & bot >= top
  17. {
  18.     if((aRect.right >= aRect.left) && (aRect.bottom >= aRect.top))
  19.         return true;
  20.     else
  21.         return false;
  22. }
  23.  
  24.  
  25. // end-of-file